﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using DailyDiet.Services;
using DailyDiet.Services.Impl;
using Moq;
using NUnit.Framework;

namespace DailyDietTest.Helper
{
    public static class FavoriteStorageServiceHelper {
        private static IFavoriteStorageService _favoriteStorageService;
        public static async Task<IFavoriteStorageService> getFavoriteStorage()
        {
            if (_favoriteStorageService != null) {
                return _favoriteStorageService;
            }
            var preferenceMock = new Mock<IPreferenceStorage>();
            _favoriteStorageService =
                new FavoriteStorageService(preferenceMock.Object);
            await _favoriteStorageService.InitializeAsync();
            return _favoriteStorageService;
        }
        public static void removeDatabase()
        {
            File.Delete(FavoriteStorageService.DBPath);
        }
    }
}
